var app =
    angular.module('app')
        .config(
            ['$controllerProvider', '$compileProvider', '$filterProvider', '$provide',
                function ($controllerProvider, $compileProvider, $filterProvider, $provide) {
                    //把controller 、directive 、service 加载到app
                    app.controller = $controllerProvider.register;
                    app.directive = $compileProvider.directive;
                    app.filter = $filterProvider.register;
                    app.factory = $provide.factory;
                    app.service = $provide.service;
                    app.constant = $provide.constant;
                    app.value = $provide.value;
                }
            ])
        .config(['$translateProvider', function ($translateProvider) {
            // 配置加载国际化文件
            $translateProvider.useStaticFilesLoader({
                prefix: 'i18n/',
                suffix: '.json'
            });
            // 默认使用中文
            $translateProvider.preferredLanguage('zh_cn');
            // 启动缓存处理
            $translateProvider.useLocalStorage();
        }])
        .config(['LoggerProvider', function (LoggerProvider) {
            //日志启动开关true-开启,false-关闭
            LoggerProvider.enabled(true);
        }])
        .config(["$httpProvider", function ($httpProvider) {
            $httpProvider.interceptors.push('httpInterceptor');
        }])
        .config(["w5cValidatorProvider", function (w5cValidatorProvider) {
            // 全局配置
            w5cValidatorProvider.config({
                blurTrig   : true,
                removeError: function(elem, errorMessages){
                    $(elem).tooltip('destroy');
                    $(elem).removeClass("error").addClass("valid");
                },
                showError:function(elem, errorMessages){
                    $(elem).tooltip('destroy');
                    $(elem).tooltip({
                        toggle: 'tooltip',
                        placement: 'top',
                        title: errorMessages
                    });
                    $(elem).removeClass("valid").addClass("error");
                }
            });
            w5cValidatorProvider.preferredLanguage("zh_cn");
            w5cValidatorProvider.useStaticFilesLoader({
                prefix: 'i18n/',
                suffix: '.json'
            });
        }]
    )
;